﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;

namespace GSSoftSL.Web.Models
{
    public partial class KhoaHocHocPhi : INotifyPropertyChanged 
    {
        public static Action CallBack;

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }

        private Guid _khoaHocId;
        [Key,DataMember]
        public Guid KhoaHocId
        {
            get { return _khoaHocId; }
            set
            {
                if (_khoaHocId != value)
                {
                    _khoaHocId = value;
                    NotifyPropertyChanged("KhoaHocId");
                }
            }
        }
        
        private Guid _lopId;
        [DataMemberAttribute()]
        public Guid LopId
        {
            get
            {
                return _lopId;
            }
            set
            {
                if (_lopId == value)
                {
                    return;
                }
                _lopId = value;
                NotifyPropertyChanged("LopId");
            }
        }
        
        private string _maKhoaHoc;
        [DataMemberAttribute()]
        public string MaKhoaHoc
        {
            get
            {
                return _maKhoaHoc;
            }
            set
            {
                if (_maKhoaHoc == value)
                {
                    return;
                }
                _maKhoaHoc = value;
                NotifyPropertyChanged("MaKhoaHoc");
            }
        }
        
        private string _tenKhoaHoc;
        [DataMemberAttribute()]
        public string TenKhoaHoc
        {
            get
            {
                return _tenKhoaHoc;
            }
            set
            {
                if (_tenKhoaHoc == value)
                {
                    return;
                }
                _tenKhoaHoc = value;
                NotifyPropertyChanged("TenKhoaHoc");
            }
        }
        
        private DateTime _batDau;
        [DataMemberAttribute()]
        public DateTime BatDau
        {
            get
            {
                return _batDau;
            }
            set
            {
                if (_batDau == value)
                {
                    return;
                }
                _batDau = value;
                NotifyPropertyChanged("BatDau");
            }
        }
        
        private DateTime _ketThuc;
        [DataMemberAttribute()]
        public DateTime KetThuc
        {
            get
            {
                return _ketThuc;
            }
            set
            {
                if (_ketThuc == value)
                {
                    return;
                }
                _ketThuc = value;
                NotifyPropertyChanged("KetThuc");
            }
        }
        
        private string _tenLop;
        [DataMemberAttribute()]
        public string TenLop
        {
            get
            {
                return _tenLop;
            }
            set
            {
                if (_tenLop == value)
                {
                    return;
                }
                _tenLop = value;
                NotifyPropertyChanged("TenLop");
            }
        }
        
        private string _tenMon;
        [DataMemberAttribute()]
        public string TenMon
        {
            get
            {
                return _tenMon;
            }
            set
            {
                if (_tenMon == value)
                {
                    return;
                }
                _tenMon = value;
                NotifyPropertyChanged("TenMon");
            }
        }

        private string _tenGV;
        [DataMemberAttribute()]
        public string TenGV
        {
            get
            {
                return _tenGV;
            }
            set
            {
                if (_tenGV == value)
                {
                    return;
                }
                _tenGV = value;
                NotifyPropertyChanged("TenGV");
            }
        }
        
        private decimal _hocPhiDeNghi;
        [DataMemberAttribute()]
        public decimal HocPhiDeNghi
        {
            get
            {
                return _hocPhiDeNghi;
            }
            set
            {
                if (_hocPhiDeNghi == value)
                {
                    return;
                }
                _hocPhiDeNghi = value;
                NotifyPropertyChanged("HocPhiDeNghi");
            }
        }

        private decimal _mucGiam;
        [DataMemberAttribute()]
        public decimal MucGiam
        {
            get
            {
                return _mucGiam;
            }
            set
            {
                if (_mucGiam == value)
                {
                    return;
                }
                _mucGiam = value;
                NotifyPropertyChanged("MucGiam");
            }
        }
        
        private decimal _hocPhiSauGiam;
        [DataMemberAttribute()]
        public decimal HocPhiSauGiam
        {
            get
            {
                return _hocPhiSauGiam;
            }
            set
            {
                if (_hocPhiSauGiam == value)
                {
                    return;
                }
                _hocPhiSauGiam = value;
                NotifyPropertyChanged("HocPhiSauGiam");
            }
        }

        private int _trangThaiHocPhi = 0;
        [DataMemberAttribute()]
        public int TrangThaiHocPhi
        {
            get
            {
                return _trangThaiHocPhi;
            }
            set
            {
                if (_trangThaiHocPhi == value)
                {
                    return;
                }
                _trangThaiHocPhi = value;
                NotifyPropertyChanged("TrangThaiHocPhi");
                if ((EnumTrangThaiHocPhi)_trangThaiHocPhi == EnumTrangThaiHocPhi.NuaKhoa)
                    HocPhiSauGiam = HocPhiTheoTrangThai = _hocPhiDeNghi / 2;
                else
                    HocPhiSauGiam = HocPhiTheoTrangThai = _hocPhiDeNghi;
                if (CallBack != null)
                    CallBack();
            }
        }

        private decimal _hocPhiTheoTrangThai = 0;
        [DataMemberAttribute()]
        public decimal HocPhiTheoTrangThai
        {
            get
            {
                return _hocPhiTheoTrangThai;
            }
            set
            {
                if (_hocPhiTheoTrangThai == value)
                {
                    return;
                }
                _hocPhiTheoTrangThai = value;
                NotifyPropertyChanged("HocPhiTheoTrangThai");
            }
        }

        private bool _canChangeTrangThaiHocPhi = false;
        [DataMemberAttribute()]
        public bool CanChangeTrangThaiHocPhi
        {
            get
            {
                return _canChangeTrangThaiHocPhi;
            }
            set
            {
                if (_canChangeTrangThaiHocPhi == value)
                {
                    return;
                }
                _canChangeTrangThaiHocPhi = value;
                NotifyPropertyChanged("CanChangeTrangThaiHocPhi");
            }
        }

        /*public string MaKhoaHoc { get; set; }
        public string TenKhoaHoc { get; set; }
        public DateTime BatDau { get; set; }
        public DateTime KetThuc { get; set; }
        public string TenLop { get; set; }
        public string TenMon { get; set; }
        public string TenGV { get; set; }
        public decimal HocPhiDeNghi { get; set; }
        public decimal MucGiam { get; set; }
        public decimal HocPhiSauGiam { get; set; }
        public bool DaDong { get; set; }*/

        public KhoaHocHocPhi CreateCopy()
        {
            KhoaHocHocPhi khhp = new KhoaHocHocPhi();
            khhp._khoaHocId = _khoaHocId;
            khhp._lopId = _lopId;
            khhp._maKhoaHoc = _maKhoaHoc;
            khhp._tenKhoaHoc = _tenKhoaHoc;
            khhp._batDau = _batDau;
            khhp._ketThuc = _ketThuc;
            khhp._tenLop = _tenLop;
            khhp._tenMon = _tenMon;
            khhp._tenGV = _tenGV;
            khhp._hocPhiDeNghi = _hocPhiDeNghi;
            khhp._mucGiam = _mucGiam;
            khhp._hocPhiSauGiam = _hocPhiSauGiam;
            khhp._trangThaiHocPhi = _trangThaiHocPhi;
            khhp._canChangeTrangThaiHocPhi = _canChangeTrangThaiHocPhi;
            return khhp;
        }
    }
}